<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
namespace App\Api\Controllers\Auths;

use App\Api\BaseApi;
use App\Models\GroupOrder;
use App\Models\ProductOrder;

class RecordApi extends BaseApi
{
    //拼团
    public function groupOrderRecord()
    {
        $data = GroupOrder::query()
            ->select(['id', 'user_id', 'status', 'amount'])
            ->where('user_id', self::UserId())
            ->get();
        $product_money = ProductOrder::query()
            ->where('user_id', self::UserId())
            ->get()->sum('total_amount');
        return responses([
            'count' => $data->count(),
            'success' => $data->where('status', 3)->count(),
            'success_money' => $data->where('status', 3)->sum('amount'),
            'product_money' => $product_money,
        ]);
    }

    //我的消费
    public function myConsumption()
    {
    }
}
